<!-- catalog/templates/catalog/author_detail.html -->
{% extends "base_generic.html" %}

{% block content %}
    <h1>作者详情</h1>

    <div class="author-detail">
        <div class="author-name">
            <h2>{{ author.last_name }}, {{ author.first_name }}</h2>
        </div>

        <div class="author-info">
            <p><strong>出生日期:</strong> {% if author.date_of_birth %}{{ author.date_of_birth }}{% else %}未知{% endif %}</p>
            <p><strong>逝世日期:</strong> {% if author.date_of_death %}{{ author.date_of_death }}{% else %}至今{% endif %}</p>
<p>
    <strong>作者:</strong>

  <a href="{% url 'author-detail' book.author.pk}">{{ book.author }}</a>
</p>
            <h3>著作</h3>
            {% if author.book_set.all %}
            <ul>
                {% for book in author.book_set.all %}
                <li>
                    <a href="{% url 'book-detail' book.pk %}">{{ book.title }}</a>
                    ({{ book.publish_date }})
                </li>
                {% endfor %}
            </ul>
            {% else %}
                <p>{{ author.last_name }} 没有著作。</p>
            {% endif %}
        </div>
    </div>
{% endblock %}
